Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller Module Header File #34

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Controller Module Header File #34

wants to merge 7 commits into from

Conversation

riyapatel25
Copy link

@riyapatel25 riyapatel25 commented Nov 25, 2024

Added header file for controller modules

  • defined structs and public interfaces

@JasonBrave
Copy link
Member

Have you looked at the embedded coding standard yet https://docs.waterloorocketry.com/general/standards/embedded-coding-standard.html

src/application/controller/controller.h Outdated Show resolved Hide resolved
float timestamp; // Timestamp in ms
} controller_state_t;

// Output of controller to be sent to servo via CAN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Output of controller to be sent to servo motor controller board via CAN

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attitude is a 4 vector with the quaternions q0 - q3.
State vector also includes canard coefficient CL, and canard angle delta, which are both states

src/application/controller/controller.h Outdated Show resolved Hide resolved
* @param output Pointer to store output -> type defined in state_estimation.h
* @return false if no output available
*/
bool Controller_Get_Latest_Output(control_output_SE_t *output);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure state_estimation.h correctly defines control_output_SE_t

src/application/controller/controller.h Show resolved Hide resolved
@celery6 celery6 linked an issue Nov 29, 2024 that may be closed by this pull request
Copy link
Collaborator

@celery6 celery6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some comments in the google doc
@Joe-Joe-Joe-Joe @FinnBreu can u guys also review the design in the google doc?

float actual_angle; // Current angle
uint32_t timestamp; // Timestamp
uint32_t servo_id; // Servo identifier
} controller_can_output_t;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an internal thing right? does it need to be exposed in this .h

@Joe-Joe-Joe-Joe
Copy link

Comments in the gdoc

#include <stdbool.h>

/* Enums/Types */
typedef struct {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#41
im gonna make vectors a common project-wide type

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#44
pls use the project-wide vector type and lmk if the common types need changes

@celery6 celery6 requested a review from taisirhassan December 20, 2024 18:46
@SAT-oO SAT-oO requested a review from Redstone-ray January 22, 2025 23:21
#define CONTROLLER_H_

#include "FreeRTOS.h"
#include "state_estimation.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "application/estimator/estimator.h"

* Must be called before RTOS scheduler starts
* @return true if initialization successful
*/
bool controller_init(void);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the bools here should be replaced with w_status_t and include "rocketlib/include/common.h"

// 2.1 Gain table and flight conditions would go here (not shown)

// 2.2 Controller initialization with memory checks
float* g0 = (float*)malloc(sizeof(float));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we dynamically allocating all theese variables?

FinnBreu

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

controller module design
9 participants